/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.muni.fi.pa165.mushroom.website.client.validator;

import cz.muni.fi.pa165.mushroom.website.client.dto.ForestDto;
import org.springframework.stereotype.Component;
import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;

/**
 *
 * @author roman
 */
@Component("forestValidator")
public class ForestValidator implements Validator{  


    @Override
    public boolean supports(Class<?> clazz) {
        return ForestDto.class.isAssignableFrom(clazz);
    }

    @Override
    public void validate(Object target, Errors errors) {
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "name", "forest.empty.name");    
        
    }
}
